package com.yinhe.system.service.impl;

import java.util.List;

import com.yinhe.common.annotation.DataScope;
import com.yinhe.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yinhe.system.mapper.YhPhonerecordMapper;
import com.yinhe.system.domain.YhPhonerecord;
import com.yinhe.system.service.IYhPhonerecordService;

/**
 * 电话记录Service业务层处理
 * 
 * @author yinhe
 * @date 2022-07-13
 */
@Service
public class YhPhonerecordServiceImpl implements IYhPhonerecordService 
{
    @Autowired
    private YhPhonerecordMapper yhPhonerecordMapper;

    /**
     * 查询电话记录
     * 
     * @param id 电话记录主键
     * @return 电话记录
     */
    @Override
    public YhPhonerecord selectYhPhonerecordById(Long id)
    {
        return yhPhonerecordMapper.selectYhPhonerecordById(id);
    }

    /**
     * 查询电话记录列表
     * 
     * @param yhPhonerecord 电话记录
     * @return 电话记录
     */
    @Override
    @DataScope(deptAlias = "yh_phonerecord", userAlias = "yh_phonerecord")
    public List<YhPhonerecord> selectYhPhonerecordList(YhPhonerecord yhPhonerecord)
    {
        return yhPhonerecordMapper.selectYhPhonerecordList(yhPhonerecord);
    }

    /**
     * 新增电话记录
     * 
     * @param yhPhonerecord 电话记录
     * @return 结果
     */
    @Override
    public int insertYhPhonerecord(YhPhonerecord yhPhonerecord)
    {
        yhPhonerecord.setCreateTime(DateUtils.getNowDate());
        return yhPhonerecordMapper.insertYhPhonerecord(yhPhonerecord);
    }

    /**
     * 修改电话记录
     * 
     * @param yhPhonerecord 电话记录
     * @return 结果
     */
    @Override
    public int updateYhPhonerecord(YhPhonerecord yhPhonerecord)
    {
        yhPhonerecord.setUpdateTime(DateUtils.getNowDate());
        return yhPhonerecordMapper.updateYhPhonerecord(yhPhonerecord);
    }

    /**
     * 批量删除电话记录
     * 
     * @param ids 需要删除的电话记录主键
     * @return 结果
     */
    @Override
    public int deleteYhPhonerecordByIds(Long[] ids)
    {
        return yhPhonerecordMapper.deleteYhPhonerecordByIds(ids);
    }

    /**
     * 删除电话记录信息
     * 
     * @param id 电话记录主键
     * @return 结果
     */
    @Override
    public int deleteYhPhonerecordById(Long id)
    {
        return yhPhonerecordMapper.deleteYhPhonerecordById(id);
    }
}
